VAR t: TextModels.Model; f: TextMappers.Formatter; v: Views.View;
BEGIN
t := TextModels.dir.New();
f.ConnectTo(t);
f.WriteString(adr.name); f.WriteTab;
f.WriteString(adr.street); f.WriteTab;
f.WriteString(adr.city); f.WriteTab;
f.WriteString(adr.state); f.WriteTab;
f.WriteString(adr.ZIP); f.WriteTab;
f.WriteString(adr.country); f.WriteTab;
f.WriteInt(adr.customer); f.WriteTab;
f.WriteBool(adr.update); f.WriteLn;
v := TextViews.dir.New(t);
Views.OpenView(v)
END Text;
BEGIN
adr.Text := Text
END ObxAddress1.
TextControllers.StdCtrlDesc
TextControllers.ControllerDesc
Containers.ControllerDesc
Controllers.ControllerDesc
Helvetica
Helvetica
Helvetica
Oberon by Example: ObxAddress1
This example combines some features of the previous examples: it takes the address record of ObxAddress1 and adds behavior to it. Such a record, whose fields are displayed by controls, is called an interactor.
The behavior for our example interactor is defined through the assignment of the global Text procedure to the adr.Text record field. The procedure creates a new text, into which it writes all the fields of the address record. The fields are written as one line of text, separated by tabulators and terminated by a carriage return. A new text view on this text is then opened in a window.
After the example has been compiled, and after a form has been created for it and turned into a dialog, you can enter something into the fields (note that customer only accepts numeric values). Then click in the Text button. A window will be opened with a contents similar to the following: